#include<iostream>
using namespace std;
#include<string>

string addBinary(string a, string b) {
    int lengthA = a.size() - 1;
    int lengthB = b.size() - 1;
    string s;
    int cur = 0;
    int next = 0;
    while (lengthA >= 0 && lengthB >= 0)
    {
        cur = (next + a[lengthA] + b[lengthB] - 96) % 2;
        next = (next + a[lengthA] + b[lengthB] - 96) / 2;
        s += (cur + 48);
        lengthA--;
        lengthB--;
    }

    while (lengthA >= 0)
    {
        cur = (next + a[lengthA] - 48) % 2;
        next = (next + a[lengthA] - 48) / 2;
        s += (cur + 48);
        lengthA--;
    }
    while (lengthB >= 0)
    {
        cur = (next + b[lengthB] - 48) % 2;
        next = (next + b[lengthB] - 48) / 2;
        s += (cur + 48);
        lengthB--;
    }

    if (next > 0)
    {
        s += '1';
    }
    reverse(s.begin(), s.end());
    return s;

}


int main()
{
    string a = "11";
    string b = "1";

    addBinary(a, b);
	return 0;
}